package com.bcxj.apipassenger.controller;

import com.bcxj.apipassenger.Service.UserService;
import com.bcxj.internalcommon.dto.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * ClassName: UserService
 * Package: com.bcxj.apipassenger.controller
 * Description:
 *
 * @Author BCXJ
 * @Create 2024/10/3 20:50
 * @Version 1.0
 * @Since 1.0
 */
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    /**
     * 获取用户信息根据Token
     * @param request
     * @return
     */
    @GetMapping
    public ResponseResult getUser(HttpServletRequest request) {
        return userService.getUserByAccessToken(request.getHeader("Authorization"));
    }

}
